<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
UserBean user = (UserBean)request.getSession().getAttribute("userBean");

String announcementLimit = user.getGlobalMap().get("Announcement Limit");
String announcementTime = user.getGlobalMap().get("Announcement Time");
String noticeTime = user.getGlobalMap().get("Notice Time");

String _db = user.getDbType();

String type = request.getParameter("type");
// 设置搜索条件中的年份和季度
Calendar cal = Calendar.getInstance();
int nowYear = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH) + 1;
int quarter = 0;

StringBuffer quarterSb = new StringBuffer();
if("1".equals(type)){
	switch(month){
		case 1:;
		case 2:;
		case 3:quarter = 1;break;
		case 4:;
		case 5:;
		case 6:quarter = 2;break;
		case 7:;
		case 8:;
		case 9:quarter = 3;break;
		case 10:;
		case 11:;
		case 12:quarter = 4;break;
	}
	quarterSb.append("<select id='quarter_option' style='width: 164px;'><option value='1' ").append((quarter == 1) ? "selected='selected'" : "").append(">第1季度</option><option value='2' ").append((quarter == 2) ? "selected='selected'" : "").append(">第2季度</option><option value='3' ").append((quarter == 3) ? "selected='selected'" : "").append(">第3季度</option><option value='4' ").append((quarter == 4) ? "selected='selected'" : "").append(">第4季度</option></select>");
}else{
	quarter = 0;
	quarterSb.append("<select id='quarter_option' style='width: 164px;' disabled><option value='0' ").append((quarter == 1) ? "selected='selected'" : "").append(">第1季度</option><option value='0' ").append((quarter == 2) ? "selected='selected'" : "").append(">第2季度</option><option value='0' ").append((quarter == 3) ? "selected='selected'" : "").append(">第3季度</option><option value='0' ").append((quarter == 4) ? "selected='selected'" : "").append(">第4季度</option></select>");
}
String quarterOptions = quarterSb.toString();

StringBuffer yearSb = new StringBuffer();
yearSb.append("<select id='year_option' style='width: 164px;'>");
for(int i = 2010 ; i <= nowYear + 1 ; i++){
	yearSb.append("<option value='").append(i).append("' ");
	if(i == nowYear){
		yearSb.append("selected='selected'");
	}
	yearSb.append(" >").append(i).append("</option>");
}
yearSb.append("</select>");
String yearOptions = yearSb.toString();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>"/>
		<meta http-equiv="pragma" content="no-cache"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />
		<style type="text/css">
		html{
			background-color:#EAEEF5;
			height:auto;
			width:1250px;
			overflow: scroll;
		}
		
		body{
			height:auto;
			width:1250px;
			overflow: hidden;
		}
		
		#hack_for_ie6{
			display:none;
			_display:block;
			_height:50px;
		}
		#baobiao_table{
			border:1px #222222 solid;
			border-collapse:collapse;
			width:1212px;
		}
		.fixd_head{
			position:fixed;
			left:0px;
			top:29px;
			width:1212px;
			background-color:#EAEEF5;
		}
		.placeholder_head{
			*display:none;
		}
		#search{
			position:fixed;
			*position:static;
			width:100%;
			left:0px;
			top:0px;
			background-color:#EAEEF5;
		}
		#baobiao_table td{
			margin:0px;
			padding:0px;
			border:1px #222222 solid;
			font-size:14px;
			text-align:center;
		}
		#baobiao_table thead td{
			color:#3893CC;
			font-weight: bold;
			text-align:center;
		}
		#baobiao_table tbody td{
			height:27px;
			text-align:right;
		}
		#baobiao_table tfoot td{
			text-align:left;
			padding-left:5px;
			text-align:left;
		}
		.col_num_tr td{
			height:40px;
		}
		#baobiao_table #date_td{
			text-align:right;
		}
		#baobiao_table #title_td{
			font-size:18px;
			font-weight:700;
		}
		#baobiao_table .orgname_td{
			text-align:left;
			!font-size:12px;
		}
		#baobiao_table .children_tr td{
			text-align:right;
			font-size:13px;
		}
		#baobiao_table #date_month,#date_day{
			width:30px;
			text-align:right;
		}
		.table_input{
			padding:0px;
			margin:0px;
			width:92%;
			font-size:13px;
			background:none;
			border:1px #EAEEF5 solid;
			text-align:right;
		}
		.otr_input{
			font-size:13px;
			font-weight:100;
		}
		
		#baobiao_form tbody td a{
			text-decoration:none;
			color:#000000;
		}
		
		#baobiao_form tbody td a:hover{
			text-decoration:none;
			color:#4fa8e6;
		}
	    </style>
	
		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/validata.js"></script>

		<script type="text/javascript" src="ligerUI/js/plugins/ligerGrid.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerTree.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerForm.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerDateEditor.js"></script>
		
		<script type="text/javascript">
			var _db = '<%=_db%>';
			
			var _date = new Date();
			var _year = <%=nowYear%>;
			var _month = _date.getMonth() + 1;
			var _day = _date.getDate();
			var _quarter = "<%=quarter%>";
			var _type = "<%=type%>";
			var _curOrgId = "<%=user.getCurOrgId()%>";
			var _shangbao = "0";
			
			var baobiao_alert_win;
			
			_jsonObj.classname = "com.wxtf.platform.main.tjbb.Baobiao2Action";
			_jsonObj.methodname = "queryPage";
			_jsonObj.logicdata = "[{\"type\":\"" + _type + "\",\"year\":\"" + _year + "\",\"quarter\":\"" + _quarter + "\"}]";

			var _dataTotal = 0;
			$(document).ready(function(){
				doSearch();
				
				$(".baobiao_submit").click(function(){
					$.ligerDialog.confirm('您确定要上报该报表吗？', function (result) { 
						if(result == true){
							_jsonObj.logicdata = getCurOrgJSONData();
							_jsonObj.methodname = "save";
							callserver(_jsonObj, function(data){
								if(data.status == "success"){
									succMsgTip(data.message);
									$(".baobiao_submit").attr("disabled","disabled").attr("title","已经上报");;
									$("#date_month").attr("disabled","disabled").attr("title","已经上报");
									$("#date_day").attr("disabled","disabled").attr("title","已经上报");
									$("#tbr_name").attr("disabled","disabled").attr("title","已经上报");
									$("#tbr_tel").attr("disabled","disabled").attr("title","已经上报");
									$(".baobiao_edit").removeAttr("disabled");
									_shangbao = "0";
									$(".orgname_td input:checkbox").hide();
									$(".baobiao_sendback").hide();
								}else{
									warningTip(data.message);
								}
							}, ajaxCallbackErrorFunc);
						}
					});
				});
				

				$(".baobiao_sendback").click(function(){
					if($(".orgname_td > input:checkbox[checked='checked']").size() == 0){
						warningTip("请先选择要退回的部门，点击对应部门名称前面的选框进行选择！");
						return false;
					}
					$.ligerDialog.confirm("请谨慎操作，退回报表二后报表一也将一同退回！同时，如果您退回的是第四季度报表，年报表一和二也将退回。您确定要退回所选部门的报表吗？", function (result) { 
						if(result == true){
							var sendbackOrgIds = "";
							$(".orgname_td > input:checkbox[checked='checked']").each(function(){
								if(sendbackOrgIds != ""){
									sendbackOrgIds = "," + sendbackOrgIds + $(this).val();
								}else{
									sendbackOrgIds = sendbackOrgIds + $(this).val();
								}
							});
							
							_jsonObj.logicdata = "[{\"type\":\"" + _type + "\",\"year\":\"" + _year + "\",\"quarter\":\"" + _quarter + "\",\"org_ids\":\"" + sendbackOrgIds + "\",\"org_id\":\"" + _curOrgId + "\"}]";
							_jsonObj.methodname = "sendback";
							callserver(_jsonObj, function(data){
								if(data.status == "success"){
									succMsgTip(data.message);
									doSearch();
								}else{
									warningTip(data.message);
								}
							}, ajaxCallbackErrorFunc);
						}
					});
				});
				
				$(".baobiao_edit").click(function(){
					window.location.href="<%=basePath%>jsp/tjbb/rkyjhsy_2_edit.jsp?type=" + _type + "&year=" + _year + "&quarter=" + _quarter;
				});
				
				$(".baobiao_alert").click(function(){
					var unsubmit = getUnsubmitData();
					$("#announcement_content").val("请以下单位（" + unsubmit.names + "）于<%=announcementLimit%>日前及时上报" + _year + "年" + ((_type == 1) ? "第" + _quarter + "季度" : "") + "人口与计划生育统计表。");
					if(baobiao_alert_win == null){
						baobiao_alert_win = initWindowByDiv('baobiao_alert', '发送通知公告', 540, 360,function(){
							$.ligerDialog.confirm("您确定要发送提醒通知和公告吗？", function (result) {
								if(result == true){
									_jsonObj.logicdata = "[{\"type\":\"" + _type + "\",\"year\":\"" + _year + "\",\"quarter\":\"" + _quarter + "\",\"ids\":\"" + unsubmit.ids + "\",\"announcement\":\"" + encodeURI(encodeURI($("#announcement_content").val())) + "\",\"atime\":\"" + $("#announcement_time").val() + "\",\"ntime\":\"<%=noticeTime%>\"}]";
									_jsonObj.methodname = "alert";
									callserver(_jsonObj, function(data){
										if(data.status == "success"){
											succMsgTip(data.message);
										}else{
											warningTip(data.message);
										}
									}, ajaxCallbackErrorFunc);
								}
								baobiao_alert_win.hide();
							});
						},function(item, dialog){
							dialog.hide();
						});
					}else{
						baobiao_alert_win.show();
					}
				});
				
				$(".baobiao_pickup").click(function(){
					$.ligerDialog.confirm("您确定要采用一键上报吗？系统会自动提取未上报部门的所有报表数据，并完成上报。", function (result) {
						if(result == true){
							_jsonObj.logicdata = "[{\"type\":\"" + _type + "\",\"year\":\"" + _year + "\",\"quarter\":\"" + _quarter + "\"}]";
							_jsonObj.methodname = "pickup";
							callserver(_jsonObj, function(data){
								if(data.status == "success"){
									succMsgTip(data.message);
								}else{
									warningTip(data.message);
								}
							}, ajaxCallbackErrorFunc);
						}
					});
				});
				
				$(".fixd_head").css("left","-" + $(document).scrollLeft() + "px");
				$(window).scroll(function(){
					$(".fixd_head").css("left","-" + $(document).scrollLeft() + "px");
				});
            });
            
            function doSearch(){
            	$("#baobiao_table tbody").html("");
            	_year = $("#year_option").val();
            	_quarter = $("#quarter_option").val();
            	$("#date_year").text(_year);
            	$("#title_td").html('第一汽车集团公司人口与计划生育' + _year + '年' + ((_type == 1) ? '第' + _quarter + '季度' : '') + '统计表（二）');
            	_jsonObj.methodname = "queryPage";
				_jsonObj.logicdata = "[{\"type\":\"" + _type + "\",\"year\":\"" + _year + "\",\"quarter\":\"" + _quarter + "\"}]";
            	callserver(_jsonObj, function(data, textStatus){
					if(data.Total > 0){
						_dataTotal = data.Total;
						_shangbao = data.Shangbao;
						var row;
						row = data.Sum;
						var tr = '<tr><td>&nbsp;</td>';
						tr = tr + '<td class="orgname_td">合计</td>';
						tr = tr + '<td id="sum_e_zgrs_hj">' + trimzero(row.e_zgrs_hj) + '</td>'
							+ '<td id="sum_e_zgrs_nan">' + trimzero(row.e_zgrs_nan) + '</td>'
							+ '<td id="sum_e_zgrs_nv">' + trimzero(row.e_zgrs_nv) + '</td>'
							+ '<td id="sum_e_hyzk_jhrs">' + trimzero(row.e_hyzk_jhrs) + '</td>'
							+ '<td id="sum_e_hyzk_whrs">' + trimzero(row.e_hyzk_whrs) + '</td>'
							+ '<td id="sum_e_hyzk_whl">' + trimzero(row.e_hyzk_whl) + '</td>'
							+ '<td id="sum_e_syqk_csyes">' + trimzero(row.e_syqk_csyes) + '</td>'
							+ '<td id="sum_e_syqk_qz_jhnyt">' + trimzero(row.e_syqk_qz_jhnyt) + '</td>'
							+ '<td id="sum_e_syqk_qz_jhnet">' + trimzero(row.e_syqk_qz_jhnet) + '</td>'
							+ '<td id="sum_e_syqk_qz_jhwcs">' + trimzero(row.e_syqk_qz_jhwcs) + '</td>'
							+ '<td id="sum_e_syqk_qz_wyrs">' + trimzero(row.e_syqk_qz_wyrs) + '</td>'
							+ '<td id="sum_e_syqk_qz_wyl">' + trimzero(row.e_syqk_qz_wyl) + '</td>'
							+ '<td id="sum_e_syqk_qz_jhsyl">' + trimzero(row.e_syqk_qz_jhsyl) + '</td>'
							+ '<td id="sum_e_syqk_qz_hyrs">' + trimzero(row.e_syqk_qz_hyrs) + '</td>'
							+ '<td id="sum_e_dsznqk_yingbanzheng">' + trimzero(row.e_dsznqk_yingbanzheng) + '</td>'
							+ '<td id="sum_e_dsznqk_yibanzheng">' + trimzero(row.e_dsznqk_yibanzheng) + '</td>'
							+ '<td id="sum_e_dsznqk_bzl">' + trimzero(row.e_dsznqk_bzl) + '</td>'
							+ '<td id="sum_e_dsznqk_xydszns">' + trimzero(row.e_dsznqk_xydszns) + '</td>'
							+ '<td id="sum_e_ssqk_rl">' + trimzero(row.e_ssqk_rl) + '</td>'
							+ '<td id="sum_e_ssqk_sh">' + trimzero(row.e_ssqk_sh) + '</td>'
							+ '<td id="sum_e_ssqk_jz">' + trimzero(row.e_ssqk_jz) + '</td>'
							+ '<td id="sum_e_ssqk_yc_zq">' + trimzero(row.e_ssqk_yc_zq) + '</td>'
							+ '<td id="sum_e_ssqk_yc_dyf">' + trimzero(row.e_ssqk_yc_dyf) + '</td>'
							+ '<td id="sum_e_blzsyzms">' + trimzero(row.e_blzsyzms) + '</td>'
							+ '</tr>';
						$("#baobiao_table tbody").append(tr);

						for(var i = 0 ; i < data.Total ; i++){
							row = data.Rows[i];
							if(row.create_by == 0){
								var tr = '<tr id="' + row.org_id + '" class="unsubmit"><td>' + (i + 1) + '</td>';
							}else{
								var tr = '<tr id="' + row.org_id + '"><td>' + (i + 1) + '</td>';
							}
							tr = tr + '<td class="orgname_td">';
							if(_shangbao == 1 && data.Rows[0].org_id != _curOrgId){
								$(".baobiao_sendback").show();
								tr = tr + '<input type="checkbox" value="' + row.org_id + '"/>';
							}
							if(row.Children == 0){
								tr = tr + row.org_name + '</td>';
							}else{
								tr = tr + '<a href=javascript:loadSubOrg("' + row.org_id + '") class="children_btn" id="' + row.org_id + '_children_btn">' + row.org_name + '</a></td>';
							}
							tr = tr + '<td>' + makeVed(3,row.e_zgrs_hj) + '</td>'
								+ '<td>' + makeVed(4,row.e_zgrs_nan) + '</td>'
								+ '<td>' + makeVed(5,row.e_zgrs_nv) + '</td>'
								+ '<td>' + makeVed(6,row.e_hyzk_jhrs) + '</td>'
								+ '<td>' + makeVed(7,row.e_hyzk_whrs) + '</td>'
								+ '<td>' + trimzero(row.e_hyzk_whl) + '</td>'
								+ '<td>' + makeVfd(9,row.e_syqk_csyes) + '</td>'
								+ '<td>' + makeVfd(10,row.e_syqk_qz_jhnyt) + '</td>'
								+ '<td>' + makeVfd(11,row.e_syqk_qz_jhnet) + '</td>'
								+ '<td>' + trimzero(row.e_syqk_qz_jhwcs) + '</td>'
								+ '<td>' + makeVfd(13,row.e_syqk_qz_wyrs) + '</td>'
								+ '<td>' + trimzero(row.e_syqk_qz_wyl) + '</td>'
								+ '<td>' + trimzero(row.e_syqk_qz_jhsyl) + '</td>'
								+ '<td>' + makeVfd(16,row.e_syqk_qz_hyrs) + '</td>'
								+ '<td>' + makeVed(17,row.e_dsznqk_yingbanzheng) + '</td>'
								+ '<td>' + makeVed(18,row.e_dsznqk_yibanzheng) + '</td>'
								+ '<td>' + trimzero(row.e_dsznqk_bzl) + '</td>'
								+ '<td>' + makeVfd(20,row.e_dsznqk_xydszns) + '</td>'
								+ '<td>' + makeVed(21,row.e_ssqk_rl) + '</td>'
								+ '<td>' + makeVed(22,row.e_ssqk_sh) + '</td>'
								+ '<td>' + makeVed(23,row.e_ssqk_jz) + '</td>'
								+ '<td>' + makeVed(24,row.e_ssqk_yc_zq) + '</td>'
								+ '<td>' + makeVed(25,row.e_ssqk_yc_dyf) + '</td>'
								+ '<td>' + makeVfd(26,row.e_blzsyzms) + '</td>'
							+ '</tr>';
							$("#baobiao_table tbody").append(tr);
							
						}
						
						$("#tbr_name").val(data.tbr_name);
						$("#tbr_tel").val(data.tbr_tel);
						// 如果Shangbao==0，说明已经上报过了
						if(data.Shangbao == "0"){
							$("#date_month").val(data.date_month);
							$("#date_day").val(data.date_day);
							
							$(".baobiao_submit").attr("disabled","disabled").attr("title","已经上报");
							$(".baobiao_edit").removeAttr("disabled").removeAttr("title");
							$("#date_month").attr("disabled","disabled").attr("title","已经上报");
							$("#date_day").attr("disabled","disabled").attr("title","已经上报");
							$("#tbr_name").attr("disabled","disabled").attr("title","已经上报");
							$("#tbr_tel").attr("disabled","disabled").attr("title","已经上报");
						}else{
							$("#date_month").val(_month);
							$("#date_day").val(_day);
							if(data.Total == 1){
								$(".baobiao_edit").attr("disabled","disabled").attr("title","请先上报数据再进行编辑打印！");
							}
							$(".baobiao_submit").removeAttr("disabled").removeAttr("title");
							$("#date_month").removeAttr("disabled").removeAttr("title");
							$("#date_day").removeAttr("disabled").removeAttr("title");
							$("#tbr_name").removeAttr("disabled").removeAttr("title");
							$("#tbr_tel").removeAttr("disabled").removeAttr("title");
						}
						
						//添加部门名称前面复选框的事件处理
						$(".orgname_td").children(":checkbox").change(function(){
							if($(this).attr('checked') == 'checked'){
								$(this).parent().parent().css("background-color","#d4def1");
								var now_checkbox = $(this).val();
								//↓↓↓↓↓如果允许一次退回多个部门的报表，则删除下面这段代码即可↓↓↓↓↓
								$(".orgname_td > input:checkbox[checked='checked']").each(function(){
									if($(this).val() != now_checkbox){
										$(this).removeAttr("checked");
										$(this).parent().parent().css("background-color","");
									}
								});
								//↑↑↑↑↑如果允许一次退回多个部门的报表，则删除上面这段代码即可↑↑↑↑↑
							}else{
								$(this).parent().parent().css("background-color","");
							}
						});
						
					}else{
						warningTip(data.message);
						$(".baobiao_submit").attr("disabled","disabled").attr("title",data.message);
						$("#baobiao_table tbody").append('<tr><td colspan="32" style="text-align:center"><br/>' + data.message + '<br/>&nbsp;</td></tr>');
					}
				}, ajaxCallbackErrorFunc);
            
            }
            
            /*
			 * 表格刷新
			 */
			function reload(){
				window.location.reload();
			}
			
			/*
			 * ajax成功回调
			 */
			function ajaxCallbackSuccFunc(data, textStatus){
				if(data.result || data.result == 'true'){
					succMsgTip(data.resultrecord);
				}else{
					warningTip(data.resultrecord);
				}
			}
			
			/*
			 * ajax失败回调
			 */
			function ajaxCallbackErrorFunc(data, textStatus){
				warningTip(data.resultrecord);
			}
            
            function ved(obj,column){
				var tr = $(obj).parent().parent();
				var org_id = tr.attr("id");
				var org_name = tr.children(".orgname_td:first").text();
				var url = "<%=basePath%>jsp/tjbb/employee_common.jsp?baobiao=2&type=" + _type + "&year=" + _year + "&quarter=" + _quarter + "&org_id=" + org_id + "&org_name=" + encodeURI(encodeURI(org_name)) + "&column=" + column + "&shangbao=" + _shangbao;
				window.open(url);
			}
			
			function vfd(obj,column){
				var tr = $(obj).parent().parent();
				var org_id = tr.attr("id");
				var org_name = tr.children(".orgname_td:first").text();
				var url = "<%=basePath%>jsp/tjbb/employee_family.jsp?baobiao=2&type=" + _type + "&year=" + _year + "&quarter=" + _quarter + "&org_id=" + org_id + "&org_name=" + encodeURI(encodeURI(org_name)) + "&column=" + column + "&shangbao=" + _shangbao;
				window.open(url);
			}
            
            function loadSubOrg(id){
				// 判断是否已经加载过子部门的数据
				if($(".children_" + id).size() > 0){
					if($(".children_" + id + ":hidden").size() > 0){
						$(".children_" + id).show();
					}else{
						$(".children_" + id).hide();
					}
				}else{
					_jsonObj.methodname = "querySubOrg";
					_jsonObj.logicdata = "[{\"type\":\"" + _type + "\",\"org_id\":\"" + id + "\",\"year\":\"" + _year + "\",\"quarter\":\"" + _quarter + "\"}]";
					callserver(_jsonObj, function(data){
						if(data.Total > 0){
							var row;
							var tr = "";
							for(var i = 0 ; i < data.Total ; i++){
								row = data.Rows[i];
								tr = tr + '<tr id="' + row.org_id + '" class="children_' + id + ' children_tr">'
									+ '<td class="children_td">' + (i + 1) + '</td>';
								if(row.Children == 0){
									tr = tr + '<td class="children_td orgname_td">' + row.org_name + '</td>';
								}else{
									tr = tr + '<td class="children_td orgname_td"><a href=javascript:loadSubOrg("' + row.org_id + '") class="children_btn" id="' + row.org_id + '_children_btn">' + row.org_name + '</a></td>';
								}
								
								tr = tr + '<td class="children_td">' + makeVed(3,row.e_zgrs_hj) + '</td>'
									+ '<td class="children_td">' + makeVed(4,row.e_zgrs_nan) + '</td>'
									+ '<td class="children_td">' + makeVed(5,row.e_zgrs_nv) + '</td>'
									+ '<td class="children_td">' + makeVed(6,row.e_hyzk_jhrs) + '</td>'
									+ '<td class="children_td">' + makeVed(7,row.e_hyzk_whrs) + '</td>'
									+ '<td class="children_td">' + trimzero(row.e_hyzk_whl) + '</td>'
									+ '<td class="children_td">' + makeVfd(9,row.e_syqk_csyes) + '</td>'
									+ '<td class="children_td">' + makeVfd(10,row.e_syqk_qz_jhnyt) + '</td>'
									+ '<td class="children_td">' + makeVfd(11,row.e_syqk_qz_jhnet) + '</td>'
									+ '<td class="children_td">' + trimzero(row.e_syqk_qz_jhwcs) + '</td>'
									+ '<td class="children_td">' + makeVfd(13,row.e_syqk_qz_wyrs) + '</td>'
									+ '<td class="children_td">' + trimzero(row.e_syqk_qz_wyl) + '</td>'
									+ '<td class="children_td">' + trimzero(row.e_syqk_qz_jhsyl) + '</td>'
									+ '<td class="children_td">' + makeVfd(16,row.e_syqk_qz_hyrs) + '</td>'
									+ '<td class="children_td">' + makeVed(17,row.e_dsznqk_yingbanzheng) + '</td>'
									+ '<td class="children_td">' + makeVed(18,row.e_dsznqk_yibanzheng) + '</td>'
									+ '<td class="children_td">' + trimzero(row.e_dsznqk_bzl) + '</td>'
									+ '<td class="children_td">' + makeVfd(20,row.e_dsznqk_xydszns) + '</td>'
									+ '<td class="children_td">' + makeVed(21,row.e_ssqk_rl) + '</td>'
									+ '<td class="children_td">' + makeVed(22,row.e_ssqk_sh) + '</td>'
									+ '<td class="children_td">' + makeVed(23,row.e_ssqk_jz) + '</td>'
									+ '<td class="children_td">' + makeVed(24,row.e_ssqk_yc_zq) + '</td>'
									+ '<td class="children_td">' + makeVed(25,row.e_ssqk_yc_dyf) + '</td>'
									+ '<td class="children_td">' + makeVfd(26,row.e_blzsyzms) + '</td>'
								+ '</tr>';
								
							}
							$("#" + id).after(tr);
						}
					}, ajaxCallbackErrorFunc);
				}
			}
            
			function getCurOrgJSONData(){
				var idPre = "sum_";

				var data = "[";
				var dataRow = "{";
				dataRow = dataRow + '\"org_id\" : \"' + _curOrgId + '\",';
				dataRow = dataRow + '\"e_zgrs_hj\" : \"' + makezero($("#" + idPre + "e_zgrs_hj").text()) + '\",';
				dataRow = dataRow + '\"e_zgrs_nan\" : \"' + makezero($("#" + idPre + "e_zgrs_nan").text()) + '\",';
				dataRow = dataRow + '\"e_zgrs_nv\" : \"' + makezero($("#" + idPre + "e_zgrs_nv").text()) + '\",';
				dataRow = dataRow + '\"e_hyzk_jhrs\" : \"' + makezero($("#" + idPre + "e_hyzk_jhrs").text()) + '\",';
				dataRow = dataRow + '\"e_hyzk_whrs\" : \"' + makezero($("#" + idPre + "e_hyzk_whrs").text()) + '\",';
				dataRow = dataRow + '\"e_hyzk_whl\" : \"' + makezero($("#" + idPre + "e_hyzk_whl").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_csyes\" : \"' + makezero($("#" + idPre + "e_syqk_csyes").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_qz_jhnyt\" : \"' + makezero($("#" + idPre + "e_syqk_qz_jhnyt").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_qz_jhnet\" : \"' + makezero($("#" + idPre + "e_syqk_qz_jhnet").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_qz_jhwcs\" : \"' + makezero($("#" + idPre + "e_syqk_qz_jhwcs").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_qz_wyrs\" : \"' + makezero($("#" + idPre + "e_syqk_qz_wyrs").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_qz_wyl\" : \"' + makezero($("#" + idPre + "e_syqk_qz_wyl").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_qz_jhsyl\" : \"' + makezero($("#" + idPre + "e_syqk_qz_jhsyl").text()) + '\",';
				dataRow = dataRow + '\"e_syqk_qz_hyrs\" : \"' + makezero($("#" + idPre + "e_syqk_qz_hyrs").text()) + '\",';
				dataRow = dataRow + '\"e_dsznqk_yingbanzheng\" : \"' + makezero($("#" + idPre + "e_dsznqk_yingbanzheng").text()) + '\",';
				dataRow = dataRow + '\"e_dsznqk_yibanzheng\" : \"' + makezero($("#" + idPre + "e_dsznqk_yibanzheng").text()) + '\",';
				dataRow = dataRow + '\"e_dsznqk_bzl\" : \"' + makezero($("#" + idPre + "e_dsznqk_bzl").text()) + '\",';
				dataRow = dataRow + '\"e_dsznqk_xydszns\" : \"' + makezero($("#" + idPre + "e_dsznqk_xydszns").text()) + '\",';
				dataRow = dataRow + '\"e_ssqk_rl\" : \"' + makezero($("#" + idPre + "e_ssqk_rl").text()) + '\",';
				dataRow = dataRow + '\"e_ssqk_sh\" : \"' + makezero($("#" + idPre + "e_ssqk_sh").text()) + '\",';
				dataRow = dataRow + '\"e_ssqk_jz\" : \"' + makezero($("#" + idPre + "e_ssqk_jz").text()) + '\",';
				dataRow = dataRow + '\"e_ssqk_yc_zq\" : \"' + makezero($("#" + idPre + "e_ssqk_yc_zq").text()) + '\",';
				dataRow = dataRow + '\"e_ssqk_yc_dyf\" : \"' + makezero($("#" + idPre + "e_ssqk_yc_dyf").text()) + '\",';
				dataRow = dataRow + '\"e_blzsyzms\" : \"' + makezero($("#" + idPre + "e_blzsyzms").text()) + '\"';;
				dataRow = dataRow + "}";
				data = data + dataRow;
				data = data + "]";
				return "[{\"org_id\":\"" + _curOrgId + "\",\"type\":\"" + _type + "\",\"year\":\"" + _year + "\",\"quarter\":\"" + _quarter + "\",\"date_month\":\"" + $("#date_month").val() + "\",\"date_day\":\"" + $("#date_day").val() + "\",\"tbr\":\"" + $("#tbr_name").val() + "\",\"tel\":\"" + $("#tbr_tel").val() + "\",\"data\":" + data + "}]";
			}
			
			function makezero(value){
				if(value == ""){
					return 0;
				}else{
					return value;
				}
			}
			
			function trimzero(value){
				if(value == 0){
					return "";
				}else{
					return value;
				}
			}
			
			function makeVed(col,value){
				if(value == 0){
					return "";
				}else{
					return '<a href="javascript:void(0);" onclick="ved(this,' + col + ');">' + value + '</a>';
				}
			}
			
			function makeVfd(col,value){
				if(value == 0){
					return "";
				}else{
					return '<a href="javascript:void(0);" onclick="vfd(this,' + col + ');">' + value + '</a>';
				}
			}
			
			/**
			获取未上报单位的数据
			*/
			function getUnsubmitData(){
				var size = $("#baobiao_table tbody tr.unsubmit").size();
				if(size == 0) return "";
				var ids = "";
				var names = "";
				$("#baobiao_table tbody tr.unsubmit").each(function(index){
					ids = ids + $(this).attr("id");
					names = names + $(this).children(".orgname_td:first").text();
					if(index != size - 1){
						ids = ids + ",";
						names = names + "，";
					}
				});
				return {"ids" : ids, "names" : names};
			}
		</script>
	</head>
  	<body>
  		<div id="search">
  			<table class="serTable">
				<tr>
					<td>
						年份：<%=yearOptions %>
					</td>
					<td>
						季度：<%=quarterOptions %>
					</td>
					<td>
						<input class="btn2" value="查询数据" type="button" onclick="doSearch();" class="btn2"/>
						<%if(!"0".equals(user.getOrgLevel(user.getCurOrgId()))){ %>
						<button class="baobiao_submit btn2">报表上报</button>
						<%} %>
						<button class="baobiao_edit btn2">编辑导出</button>
						<%if("1".equals(type)){ %>
						<button class="baobiao_sendback btn2" style="display:none;">退回报表</button>
						<%} %>
						<%if("0".equals(user.getOrgLevel(user.getCurOrgId()))){ %>
						<button class="baobiao_alert btn2">提醒上报</button>
						<!-- <button class="baobiao_pickup btn2">一键上报</button> -->
						<%} %>
					</td>
				</tr>
			</table>
  		</div>
	    <div id="baobiao">
	    	<form id="baobiao_form" name="baobiao_form">
	    	<table id="baobiao_table">
				<thead class="fixd_head">
					<tr><td id="title_td" colspan="32" height="40">第一汽车集团公司人口与计划生育2012年（季度）统计表（二）</td></tr>
					<tr><td id="date_td" colspan="32" height="30"><span id="date_year">2012</span>年<input type="text" id="date_month" name="date_month" validate="{required:true,digits:true,maxlength:2}" class="otr_input textbg1"/>月<input type="text" id="date_day" name="date_day" size="2" validate="{required:true,digits:true,maxlength:2}" class="otr_input textbg1"/>日</td></tr>
					<tr>
						<td rowspan="3" >序<br/><br/>号</td>
						<td rowspan="3" >单<br/><br/>位</td>
						<td colspan="3" height="50">职&nbsp;工&nbsp;人&nbsp;数</td>
						<td colspan="3">婚&nbsp;姻&nbsp;状&nbsp;况</td>
						<td colspan="8">生&nbsp;育&nbsp;情&nbsp;况</td>
						<td colspan="4">独&nbsp;生&nbsp;子&nbsp;女&nbsp;情&nbsp;况</td>
						<td colspan="5">四&nbsp;术&nbsp;情&nbsp;况</td>
						<td rowspan="3" >办<br/>理<br/>《<br/>再<br/>生<br/>育<br/>证<br/>明<br/>》<br/>数</td>
					</tr>
					<tr>
						<td rowspan="2" height="150" >合<br/><br/><br/>计</td>
						<td rowspan="2" >男<br/>职<br/>工</td>
						<td rowspan="2" >女<br/>职<br/>工</td>
						<td rowspan="2" >结<br/>婚<br/>人<br/>数</td>
						<td rowspan="2" >晚<br/>婚<br/>人<br/>数</td>
						<td rowspan="2" >晚<br/>婚<br/>率<br/>%</td>
						<td rowspan="2" >出<br/>生<br/>婴<br/>儿<br/>数</td>
						<td colspan="7">其&nbsp;&nbsp;中</td>
						<td rowspan="2" >应<br/>办<br/>证<br/>职<br/>工<br/>数</td>
						<td rowspan="2" >已<br/>办<br/>证<br/>职<br/>工<br/>数</td>
						<td rowspan="2" >办<br/>证<br/>率<br/>%</td>
						<td rowspan="2" >现<br/>有<br/>独<br/>生<br/>子<br/>女<br/>数</td>
						<td rowspan="2" >人<br/><br/><br/><br/>流</td>
						<td rowspan="2" >上<br/><br/><br/><br/>环</td>
						<td rowspan="2" >结<br/><br/><br/><br/>扎</td>
						<td colspan="2">引&nbsp;产</td>
					</tr>
					<tr>
						<td height="100" >计<br/>划<br/>内<br/>一<br/>胎</td>
						<td >计<br/>划<br/>内<br/>二<br/>胎</td>
						<td >计<br/>划<br/>外<br/>出<br/>生</td>
						<td >晚<br/>育<br/>人<br/>数</td>
						<td >晚<br/>育<br/>率<br/>%</td>
						<td >计<br/>划<br/>生<br/>育<br/>率<br/>%</td>
						<td >怀<br/>孕<br/>人<br/>数</td>
						<td >中<br/><br/><br/><br/>期</td>
						<td >大<br/><br/>月<br/><br/>份</td>
					</tr>
					<tr class="col_num_tr"><td style="width:25px">1</td><td style="width:100px">2</td><td style="width:60px">3</td><td style="width:50px">4</td><td style="width:50px">5</td><td style="width:50px">6</td><td style="width:50px">7</td><td style="width:50px">8</td><td style="width:40px">9</td><td style="width:40px">10</td><td style="width:40px">11</td><td style="width:40px">12</td><td style="width:40px">13</td><td style="width:50px">14</td><td style="width:50px">15</td><td style="width:40px">16</td><td style="width:50px">17</td><td style="width:50px">18</td><td style="width:50px">19</td><td style="width:50px">20</td><td style="width:35px">21</td><td style="width:35px">22</td><td style="width:35px">23</td><td style="width:35px">24</td><td style="width:35px">25</td><td style="width:35px">26</td></tr>
				</thead>
				<thead class="placeholder_head">
					<tr><td colspan="32" height="68">&nbsp;</td></tr>
					<tr><td colspan="32" height="30">&nbsp;</td></tr>
					<tr>
						<td rowspan="3" >序<br/><br/>号</td>
						<td rowspan="3" >单<br/><br/>位</td>
						<td colspan="3" height="50">职&nbsp;工&nbsp;人&nbsp;数</td>
						<td colspan="3">婚&nbsp;姻&nbsp;状&nbsp;况</td>
						<td colspan="8">生&nbsp;育&nbsp;情&nbsp;况</td>
						<td colspan="4">独&nbsp;生&nbsp;子&nbsp;女&nbsp;情&nbsp;况</td>
						<td colspan="5">四&nbsp;术&nbsp;情&nbsp;况</td>
						<td rowspan="3" >办<br/>理<br/>《<br/>再<br/>生<br/>育<br/>证<br/>明<br/>》<br/>数</td>
					</tr>
					<tr>
						<td rowspan="2" height="150" >合<br/><br/><br/>计</td>
						<td rowspan="2" >男<br/>职<br/>工</td>
						<td rowspan="2" >女<br/>职<br/>工</td>
						<td rowspan="2" >结<br/>婚<br/>人<br/>数</td>
						<td rowspan="2" >晚<br/>婚<br/>人<br/>数</td>
						<td rowspan="2" >晚<br/>婚<br/>率<br/>%</td>
						<td rowspan="2" >出<br/>生<br/>婴<br/>儿<br/>数</td>
						<td colspan="7">其&nbsp;&nbsp;中</td>
						<td rowspan="2" >应<br/>办<br/>证<br/>职<br/>工<br/>数</td>
						<td rowspan="2" >已<br/>办<br/>证<br/>职<br/>工<br/>数</td>
						<td rowspan="2" >办<br/>证<br/>率<br/>%</td>
						<td rowspan="2" >现<br/>有<br/>独<br/>生<br/>子<br/>女<br/>数</td>
						<td rowspan="2" >人<br/><br/><br/><br/>流</td>
						<td rowspan="2" >上<br/><br/><br/><br/>环</td>
						<td rowspan="2" >结<br/><br/><br/><br/>扎</td>
						<td colspan="2">引&nbsp;产</td>
					</tr>
					<tr>
						<td height="100" >计<br/>划<br/>内<br/>一<br/>胎</td>
						<td >计<br/>划<br/>内<br/>二<br/>胎</td>
						<td >计<br/>划<br/>外<br/>出<br/>生</td>
						<td >晚<br/>育<br/>人<br/>数</td>
						<td >晚<br/>育<br/>率<br/>%</td>
						<td >计<br/>划<br/>生<br/>育<br/>率<br/>%</td>
						<td >怀<br/>孕<br/>人<br/>数</td>
						<td >中<br/><br/><br/><br/>期</td>
						<td >大<br/><br/>月<br/><br/>份</td>
					</tr>
					<tr class="col_num_tr"><td style="width:25px">1</td><td style="width:100px">2</td><td style="width:60px">3</td><td style="width:50px">4</td><td style="width:50px">5</td><td style="width:50px">6</td><td style="width:50px">7</td><td style="width:50px">8</td><td style="width:40px">9</td><td style="width:40px">10</td><td style="width:40px">11</td><td style="width:40px">12</td><td style="width:40px">13</td><td style="width:50px">14</td><td style="width:50px">15</td><td style="width:40px">16</td><td style="width:50px">17</td><td style="width:50px">18</td><td style="width:50px">19</td><td style="width:50px">20</td><td style="width:35px">21</td><td style="width:35px">22</td><td style="width:35px">23</td><td style="width:35px">24</td><td style="width:35px">25</td><td style="width:35px">26</td></tr>
				</thead>
				<tbody>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="32" height="30">
							填表人：<input type="text" id="tbr_name" name="tbr_name" size="10" style="margin-right:400px;" class="otr_input textbg1"/>
							联系电话：<input type="text" id="tbr_tel" name="tbr_tel" size="20" class="otr_input textbg1"/>
						</td>
					</tr>
					<tr>
						<td colspan="32" height="40">
							逻辑关系:
							&nbsp;&nbsp;&nbsp;&nbsp;3=4+5;
							&nbsp;&nbsp;&nbsp;&nbsp;8=(7/6)×100%;
							&nbsp;&nbsp;&nbsp;&nbsp;9=10+11+12;
							&nbsp;&nbsp;&nbsp;&nbsp;14=(13/10)×100%;
							&nbsp;&nbsp;&nbsp;&nbsp;15=(10+11)/9×100%;
							&nbsp;&nbsp;&nbsp;&nbsp;19=(18/17)×100%;
							
						</td>
					</tr>
				</tfoot>
			</table>
			</form>
			<br/>
			<%if(!"0".equals(user.getOrgLevel(user.getCurOrgId()))){ %>
			<button class="baobiao_submit btn2">报表上报</button>
			<%} %>
			<button class="baobiao_edit btn2">编辑导出</button>
			<%if("1".equals(type)){ %>
			<button class="baobiao_sendback btn2" style="display:none;">退回报表</button>
			<%} %>
			<%if("0".equals(user.getOrgLevel(user.getCurOrgId()))){ %>
			<button class="baobiao_alert btn2">提醒上报</button>
			<!-- <button class="baobiao_pickup btn2">一键上报</button> -->
			<%} %>
			<div id="hack_for_ie6"></div>
	    </div>
	    
	    <div id="baobiao_alert" style="display: none;">
			<form id="baobiao_alert_form" name="baobiao_alert_form">
				公告内容：<br/>
				<textarea id="announcement_content" style="width:510px;height:230px;font-size:16px;line-height:22px;margin-bottom:10px;"></textarea>
				公告持续时间：<select id="announcement_time"><option value="24">一天</option><option value="48">二天</option><option value="72" selected="selected">三天</option><option value="96">四天</option><option value="120">五天</option><option value="144">六天</option><option value="168">七天</option></select>
			</form>
   		</div>
	</body>
</html>
